#include "../../include/offlinedict/DictProducer.h"
#include "../../include/offlinedict/Configuration.h"
#include "../../include/offlinedict/MyLogger.h"
#include "../../include/offlinedict/CppJieba.h"

int main(int argc,char *argv[])
{
    Configuration* conf = Configuration::getInstance();
    conf->readConfigFile("/home/yuan/Project/SearchEngine/conf/offlineDict.conf");

    CppJieba* cppjieba = CppJieba::getInstance();

    LogInfo("start");

    // 英文词典和索引
    DictProducer Endict(conf->getMapValue("EnglishYuLiao"),*cppjieba,*conf);
    Endict.buildEnDict();
    Endict.buildIndex();
    Endict.storeDict(conf->getMapValue("eg_dict.dat"));
    Endict.storeIndex(conf->getMapValue("eg_dictIndex.dat"));

    // 中文词典和索引
    DictProducer Cndict(conf->getMapValue("ChinaYuLiao"),*cppjieba,*conf);
    Cndict.buildCnDict();
    Cndict.buildIndex();
    Cndict.storeDict(conf->getMapValue("cn_dict.dat"));
    Cndict.storeIndex(conf->getMapValue("cn_dictIndex.dat"));

    LogInfo("end");
    return 0;
}